<?php

ini_alter("max_execution_time","3600");
ini_alter("default_socket_timeout","3600"); 

include_once(APPLICATION_ROOT."/web_config.php");
include_once(APPLICATION_ROOT."/config.php");
require_once(APPLICATION_ROOT."/oracleaccess/classes/DbConnect.php" );
require_once(APPLICATION_ROOT."/logs/LogApp.class" );

 $connessione = new DbConnect();//connessione viste locale

 $select_gare="SELECT CIG FROM GARE WHERE ARCHIVIATA ='N' AND CIG IN (SELECT CIG FROM V_ARCHIVIO WHERE SCHEDA='COLLAUDO' AND ARCHIVIATA='S')";
 $rs = $connessione -> doquery_oracle($select_gare, 'select');
 
 foreach($rs as $key=>$values){
	$cig_tmp=$values[1];
	$update_gare= "update gare set archiviata='S' where cig in ('".$cig_tmp."')";
	$connessione -> doquery_oracle($update_gare, 'update');
 }

echo("<br>END GARE");

?>